What is a REST API?
A REST API is like a waiter at a restaurant. You tell it what you want (make a request), and it brings you what you asked for (the response). It’s how apps talk to each other.
What Can You Do with a REST API?
REST APIs let you do four main things with data:
-
Create (POST): Add something new.
Example: Add a new task to your to-do list. -
Read (GET): Look at data.
Example: See all your tasks. -
Update (PUT): Change something.
Example: Mark a task as done. -
Delete (DELETE): Remove something.
Example: Delete a finished task.
How It Works
-
You ask for something (request).
Example: “Show me all my tasks” → UseGET
. -
The API gives you the result (response).
Example: A list of tasks.
Example
Imagine a to-do list:
- Add a task: “Add ‘Buy milk’” → The API creates it.
- See tasks: “Show me my list” → The API sends the list.
- Mark it done: “Mark ‘Buy milk’ as done” → The API updates it.
- Remove it: “Delete ‘Buy milk’” → The API deletes it.
That’s it! REST APIs are just a simple way for apps to share and manage data.